package com.msb.singleton;

/**
 * @Auther： WangLei
 * @Date： 2021/8/1-08-01-23:28
 * @Description: com.msb.singleton
 * @version: 1.0
 */
public class LazyBones1 {
    private LazyBones1(){}
    private static LazyBones1 INSTANCE = null;

    public static LazyBones1 getInstance(){
        if(INSTANCE == null){

            try {
                Thread.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            INSTANCE = new LazyBones1();
        }

        return INSTANCE;
    }

    public static void main(String[] args) {
        for(int i = 0;i < 100; i++){
            new Thread(() -> {
                System.out.println(LazyBones1.getInstance().hashCode());
            }).start();
        }
    }


}
